import 'package:flutter/material.dart';
import 'package:flutter_book_store/beans/books_entity.dart';
import 'package:get/get.dart';

class BookDetailPage extends StatelessWidget {
  final bookEntity = Get.arguments as BooksList;

  @override
  Widget build(BuildContext context) {
    return Scaffold(
      appBar: AppBar(
        title: Text(
          '书籍详情',
        ),
      ),
      body: Column(
        children: [BookDetailBar(bookEntity)],
      ),
    );
  }
}

class BookDetailBar extends GetView {
  final BooksList entity;

  BookDetailBar(this.entity);

  @override
  Widget build(BuildContext context) {
    return Column(
      crossAxisAlignment: CrossAxisAlignment.start,
      children: [
        Padding(
          padding: const EdgeInsets.all(8.0),
          child: Text(
            entity.author,
            style: TextStyle(fontSize: 24, color: Colors.black),
          ),
        ),
        Padding(
          padding: const EdgeInsets.symmetric(horizontal: 16.0),
          child: Column(
            crossAxisAlignment: CrossAxisAlignment.start,
            children: [
              Text(
                '作者:豺狼末日',
                style: TextStyle(fontSize: 16, color: Colors.black),
              ),
              Text(
                '编号:01000',
                style: TextStyle(fontSize: 16, color: Colors.black),
              ),
              Row(
                children: [
                  Text(
                    '状态:',
                    style: TextStyle(fontSize: 16, color: Colors.black),
                  ),
                  Container(
                    decoration: BoxDecoration(
                        color: Colors.green,
                        borderRadius: BorderRadius.all(Radius.circular(2))),
                    padding: EdgeInsets.symmetric(horizontal: 4, vertical: 1),
                    child: Text(
                      '状态',
                      style: TextStyle(fontSize: 14, color: Colors.white),
                    ),
                  )
                ],
              ),
              Text(
                '简介:成人小说',
                style: TextStyle(
                    fontSize: 16,
                    color: Colors.black,
                    fontWeight: FontWeight.bold),
              ),
              Text(
                '类型:十八禁',
                style: TextStyle(
                    fontSize: 16,
                    color: Colors.black,
                    fontWeight: FontWeight.bold),
              ),
              Row(
                mainAxisAlignment: MainAxisAlignment.spaceBetween,
                children: [
                  Row(
                    mainAxisAlignment: MainAxisAlignment.start,
                    children: [
                      IconButton(
                          icon: Icon(
                            Icons.star,
                            color: Colors.grey,
                          ),
                          onPressed: () {}),
                      SizedBox(
                        width: 16,
                      ),
                      IconButton(
                          icon: Icon(Icons.animation, color: Colors.grey),
                          onPressed: () {})
                    ],
                  ),
                  OutlinedButton(
                    style: TextButton.styleFrom(
                        minimumSize: Size(15, 28),
                        backgroundColor: Colors.transparent,
                        shape: RoundedRectangleBorder(
                            borderRadius: BorderRadius.all(Radius.circular(5))),
                        side:
                            BorderSide(color: Colors.grey.shade300, width: 1)),
                    onPressed: () {},
                    child: Text(
                      '借阅',
                      style: TextStyle(color: Colors.grey, fontSize: 16),
                    ),
                  )
                ],
              )
            ],
          ),
        ),
        Container(
          padding: EdgeInsets.only(left: 8),
          alignment: Alignment(-1, 0),
          height: 24,
          width: double.infinity,
          color: Colors.green.shade50,
          child: Text('热门评论(46条)'),
        )
      ],
    );
  }
}
